home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
ltcrepl.dir
/
00084_Script_shadow game 1
< prev
next >
Wrap
Text File
|
1996-05-01
|
7KB
|
240 lines
-- ---------------------------------------------------------------
-- Handler initializeShadowGame
on initializeShadowGame flag
global iconsSprite, numIcons, hilitIcon, shadow, firstPlacedShadow
global currentPlacedShadow,lastPlacedShadow,tag
global goodJob,screenLocH,screenLocV
set tag = flag
set numIcons = 15
set goodJob = 22 -- sprite containing the "good job" screen added by MB nov 12
set screenLocH = 345
set screenLocV = 206
puppetSprite goodJob, TRUE
set iconsSprite = 4
set hilitIcon = 5
set shadow = 6
set firstPlacedShadow = 7
set lastPlacedShadow = firstPlacedShadow + numIcons - 1
set currentPlacedShadow = firstPlacedShadow
repeat with i = firstPlacedShadow to lastPlacedShadow
removeFromStage(i)
end repeat
puppetSprite iconsSprite, TRUE
puppetSprite hilitIcon, TRUE
puppetSprite shadow, TRUE
repeat with i = firstPlacedShadow to lastPlacedShadow
puppetSprite i, TRUE
end repeat
-- global fingerCursor
-- set the cursor of sprite iconsSprite = fingerCursor
-- set the cursor of sprite shadow = fingerCursor
global iconInfo, shadowInfo,shadowInfo1
set iconInfo = field "icon locations"
if tag = 0 then
set shadowInfo = field "shadow locations"
else
set shadowInfo = field "shadow locations1"
end if
global placedShadowsList
set placedShadowsList = []
set the foreColor of sprite hilitIcon = 5 -- yellow
when mouseDown then shadowDrag
end
-- ---------------------------------------------------------------
-- Handler doClickIconBar is called when the user clicks on the
-- icon bar.
on doClickIconBar iconBar, clickV
global numIcons,clickedIconName
set buttonIndex = getVButtonIndex(iconBar, numIcons, clickV)
set clickedIconName = getClickedIconName(buttonIndex)
hiliteClickedIcon(buttonIndex, clickedIconName)
placeShadowOnCenterStage(buttonIndex, clickedIconName)
end
-- ---------------------------------------------------------------
-- Handler hiliteClickedIcon hilites the clicked icon on the icon
-- bar.
on hiliteClickedIcon iconIndex, clickedIconName
global hilitIcon
set iconLocation = getIconLocation(iconIndex)
set hilitCast = clickedIconName && "H"
set the castNum of sprite hilitIcon = the number of cast hilitCast
set the locH of sprite hilitIcon = value(word 1 of iconLocation)
set the locV of sprite hilitIcon = value(word 2 of iconLocation)
updateStage
end
-- -----------------------------------------------------------
-- Handler getClickedIconName returns the name of the icon clicked.
on getClickedIconName iconIndex
global iconInfo
return item 1 of line iconIndex of iconInfo
end
-- -----------------------------------------------------------
-- Handler getIconLocation returns the locH and the locV (as a
-- point) of the hilit icon.
on getIconLocation iconIndex
global iconInfo
return item 2 of line iconIndex of iconInfo
end
-- -----------------------------------------------------------
-- Handler placeShadowOnCenterStage places the shadow of the clicked icon
-- at the center of the stage.
on placeShadowOnCenterStage iconIndex, clickedIconName
global shadow, placedShadowsList,clickedIconName,hilitIcon
set shadowCast = clickedIconName && "Shadow"
set the castNum of sprite shadow = the number of cast shadowCast
if not(getPos(placedShadowsList, clickedIconName)) then
-- not placed yet
set the loch of sprite shadow = 320 -- center H
set the locv of sprite shadow = 240 -- center V
updateStage
setShadowLocations(iconIndex)
else -- placed already
removeFromStage(shadow)
beep
end if
end
-- -----------------------------------------------------------
-- Handler setShadowLocations sets the global variables shadowH
-- and shadowV to the click-to-place location of the current
-- shadow.
on setShadowLocations buttonIndex
global shadowH, shadowV, shadowInfo
set shadowH = value(word 1 of item 2 of line buttonIndex of shadowInfo)
set shadowV = value(word 2 of item 2 of line buttonIndex of shadowInfo)
end
-- -----------------------------------------------------------
-- Handler updateCurrentPlacedShadow sets the global variable
-- currentPlacedShadow to its value + 1. This handler is
-- called when the user successfully places a shadow onstage.
on updateCurrentPlacedShadow tag
global currentPlacedShadow,lastPlacedShadow,tag,hilitIcon
global screenLocH,screenLocV,goodJob
set currentPlacedShadow = currentPlacedShadow + 1
if currentPlacedShadow = lastPlacedShadow + 1 then
if tag = 0 then
removefromstage(hilitIcon)
setPos goodJob,screenLocH,screenLocV --show the 'good job" screen
puppetSound "applause"
updateStage
waitTicks 360
setPos goodJob,(screenLocH + 1000),screenLocV --hide the 'good job" screen
go to frame "LTcrePlSt2"
else
removefromstage(hilitIcon)
puppetSound "crowd"
updateStage
waitTicks 120
go to frame "LTcrePlSt1"
end if
end if
end
-- -----------------------------------------------------------
-- Handler updatePlacedShadowsList adds the just placed shadow
-- to the global variable placedShadowsList.
on updatePlacedShadowsList
global placedShadowsList, shadow
add(placedShadowsList, word 1 of the name of cast the castNum of sprite shadow)
end
-- -----------------------------------------------------------
-- Handler hilitePlacedShadow hilites the placed shadow of the
-- given name
on hilitePlacedShadow clickedIconName
global firstPlacedShadow, currentPlacedShadow
repeat with i = firstPlacedShadow to currentPlacedShadow
if the name of cast the castNum of sprite i contains clickedIconName then
repeat with j = 1 to 3
set the foreColor of sprite i = 5
updateStage
waitTicks 5
set the foreColor of sprite i = 255 -- black
updateStage
end repeat
exit repeat
end if
end repeat
end
-- Handler hilitePlacedIcon hilites the placed icon of the
-- given name
on hilitePlacedIcon clickedIconName
repeat with j = 1 to 5
set the foreColor of sprite clickedIconName = 5
updateStage
waitTicks 25
set the foreColor of sprite clickedIconName = 35 -- black
updateStage
end repeat
set the foreColor of sprite clickedIconName = 5
end
-- handler showScreen shows the "good job" screen during the applause
-- added by MB nov 12
on setPos aSprite,aLocH,aLocV
set the locH of sprite aSprite = aLocH
set the locV of sprite aSprite = aLocV
updateStage
end
-- handler waitTicksInterruptable is same as waitTicks but when clicking the
-- mouse it is interrupted.
on waitTicksInterruptable howMany
put the ticks into startTicks
repeat while the ticks < startTicks + howMany AND NOT the mouseDown
processFrame
end repeat
end